﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
    class DbHelp
    {
       public static readonly string sql1 = "server=.;database=newtext;uid=sa;pwd=123456";
        public static DataTable GetDataTable(string sql)
        {
            SqlConnection sqlConnection = new SqlConnection(sql1);
            sqlConnection.Open();
            DataTable dataTable = new DataTable();
            SqlDataAdapter dataAdapter = new SqlDataAdapter(sql,sqlConnection);           
            dataAdapter.Fill(dataTable);
            return dataTable;
        }
    }
}
